Skip to content

Add typing for perspective#157

Merged
texodus merged 1 commit intoperspective-dev:masterfrom
segarman:feature/typescript
Jul 19, 2018
Merged

Add typing for perspective#157
texodus merged 1 commit intoperspective-dev:masterfrom
segarman:feature/typescript

Conversation

@segarman
Copy link
Contributor

No description provided.

}

export type ValuesByType = {
[ key in TypeNames ]: Array<string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For primitives it's better to use string[] for arrays.

Copy link
Contributor Author

@segarman segarman Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://palantir.github.io/tslint/rules/array-type/
we use "generic" on our project, hence Array<T> over T[]
but happy to change if you want me to

Copy link
Contributor

@LukeSheard LukeSheard Jul 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, since there's no tslint setup of similar and they're equivalent let's just go with this for now. We can always change later - I just normally go with "array-simple" but consistency makes sense.

NONE = 'none',
}

enum NUMBER_AGGREGATES {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These might potentially be better as Enums rather than strings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are enums, or you mean to create a global enum with all of them and NUMBER, STRING, BOOLEAN to be just a subset of them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that maybe we can take the aggregate keywords and Enum those. But I couldn't find a nice way to make them all align up. Since these are private I'll take another look later and we can hoist them into private enums later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@timkpaine
Copy link
Member

timkpaine commented Jul 19, 2018

given that the jupyterlab sub package is already in typescript, typing should also be added there (instead of the current <any> casts).

@texodus
Copy link
Member

texodus commented Jul 19, 2018

Looks great, thanks!

@texodus texodus merged commit a0652c9 into perspective-dev:master Jul 19, 2018
@timkpaine
Copy link
Member

shouldn't the jupyterlab package use this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants